home *** CD-ROM | disk | FTP | other *** search
/ Clinical Endocrinology / Clinical Endocrinology.iso / pc / 00000000 / 07000000 / 07030000 / shared.dir / 00956_Script_956 < prev    next >
Text File  |  1995-11-17  |  2KB  |  74 lines

  1. -- Sprite 17 is the menu text sprite. Sprite 19 is a QD rect which
  2. -- is red and has "add" ink. Its initial location is above the stage.
  3. -- This handler senses how big the menu is ( how many lines etc.),
  4. -- and sizes the QD rect to fit one line at a time if the menu is
  5. -- rolled over.
  6.  
  7. on menuDrop
  8.   global greyLine, menuSwitch
  9.   
  10.   if voidP(menuSwitch) then set menuSwitch = "off"
  11.   if menuSwitch = "off" then
  12.     scaleMenuBox
  13.   end if
  14.   
  15.   getGreyLine
  16.   
  17.   put the number of lines in field "Menu Listing" into theLines
  18.   put the top of sprite 17 into theTop
  19.   put the bottom of sprite 17 - theTop into theDepth
  20.   put theDepth / theLines into theIncrement
  21.   put the width of sprite 17 into theWidth
  22.   put the left of sprite 17 into theLeft
  23.   set the height of sprite 19 to theIncrement
  24.   set the width of sprite 19 to theWidth
  25.   set the mouseDownScript to EMPTY
  26.   
  27.   repeat while rollOver(17)
  28.     set the foreColor of sprite 19 to 35
  29.     put ( the mouseV - theTop ) / theIncrement into pointerLine
  30.     if the mouseDown then
  31.       if pointerLine >= 0 and pointerLine < theLines then checkMenuChoice pointerLine
  32.     end if
  33.     set the locV of sprite 19 = theTop + (pointerLine * theIncrement)
  34.     set the locH of sprite 19 = theLeft
  35.     updateStage
  36.     
  37.   end repeat
  38.   
  39. end menuDrop
  40. --------------------------------------------------------------------
  41. -- This handler is called from the one above to sense which line
  42. -- is greyed out. The result is stored as a global.
  43.  
  44. on getGreyLine
  45.   global greyLine
  46.   put the number of lines in field "Menu Listing" into theLines
  47.   repeat with i = 1 to theLines
  48.     if the foreColor of line i of field "Menu Listing" <> 255 then
  49.       put i into greyline
  50.     end if
  51.   end repeat
  52.   
  53. end getGreyLine
  54. --------------------------------------------------------------------
  55. -- This handler is called from menuDrop (above), when the mouse is clicked.
  56. -- It ignores a click on a grey line and calls the correct handler relating
  57. -- to jumping to the correct movie ( menuItem whichLine ).
  58.  
  59. on checkMenuChoice whichLine
  60.   global greyLine, jumpFrame, menuSwitch
  61.   
  62.   put whichLine + 1 into whichLine -- incremented by 1 to relate to a text line
  63.   
  64.   if whichLine = greyLine then
  65.     set the mouseDownScript to "dontPassEvent"
  66.   else
  67.     set menuSwitch = "off"
  68.     set the mouseDownScript to EMPTY
  69.     menuItem whichLine
  70.     sound playFile 1, "Click.aif"
  71.     abort
  72.   end if
  73.   
  74. end checkMenuChoice